<!DOCTYPE html>
<html lang="zh" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('标准主列表')"/>
    <th:block th:include="include :: layout-latest-css"/>

</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>

                        <input name="params[ancestors]" th:value="${ancestors}" type="hidden"/>
                        <input name="standardType" type="hidden" value="2">

                        <li>
                            标准名称：<input name="standardName" type="text"/>
                        </li>

                        <li>
                            作物名称：<input name="cropNameCn" type="text"/>
                        </li>
                        <li>
                            作物品种：<input name="cropVarietiesCn" type="text"/>
                        </li>

                        <li class="select-time">
                            <label>标准： </label>
                            <input class="time-input" id="beginTime" name="params[beginTime]" placeholder="开始时间"
                                   th:value="${beginTime}" type="text"/>
                            <span>-</span>
                            <input class="time-input" id="endTime" name="params[endTime]" placeholder="结束时间"
                                   th:value="${endTime}" type="text"/>
                        </li>


                        <li>
                            适宜季节：<select name="season" th:with="type=${@dict.getType('nc_season')}">
                            <option value="">所有</option>
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                    th:value="${dict.dictValue}"></option>
                        </select>
                        </li>

                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>


        <div class="col-sm-12 select-table table-striped">
            <table data-mobile-responsive="true" id="bootstrap-table"></table>
        </div>

    </div>
    <div class="bottom-btns"></div>
</div>

<div th:include="include :: footer"></div>
<th:block th:include="include :: layout-latest-js"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:ncStandard:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system:ncStandard:remove')}]];
    var datas = [[${@dict.getType('nc_season')}]];
    var prefix = ctx + "system/ncStandard";

    var standardType = [[${standardType}]];
    var caiId = [[${caiId}]];
    $(function () {
        var options = {
            url: prefix + "/list",
            exportUrl: prefix + "/export",
            modalName: "标准",
            showSearch : false,
            showColumns : false,
            showExport : false,
            showRefresh : false,
            showToggle : false,
            columns: [

                {
                title: '序号',
                formatter: function (value, row, index) {
                    return $.table.serialNumber(index);
                }
            },
                {
                    field: 'standardId',
                    title: '标准id',
                    visible: false
                },
                {
                    field: 'standardName',
                    title: '标准名称',
                },
                {
                    field: 'pic',
                    title: '图片',
                    sortable: false,
                    formatter: function (value, item, index) {
                        return $.table.showPic(item.pic);
                    }
                },
                {
                    field: 'cropTypeCn',
                    title: '作物类别',
                    sortable: true
                },
                {
                    field: 'cropNameCn',
                    title: '作物名称',
                    sortable: true
                },
                {
                    field: 'cropVarietiesCn',
                    title: '作物品种',
                    sortable: true
                },
                {
                    field: 'season',
                    title: '适宜季节',
                    sortable: true,
                    formatter: function (value, item, index) {
                        return $.table.selectDictLabel(datas, item.season);
                    }
                },
                {
                    field: 'totalCycle',
                    title: '总周期(天)',
                    sortable: true
                }, {
                    field: 'createBy',
                    title: '制作人',
                    sortable: true
                },
                {
                    field: 'createTime',
                    title: '创建时间',
                    sortable: true
                },
                {
                    field: 'remark',
                    title: '备注',
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-primary btn-xs" href="javascript:void(0)" onclick="showDetails(\'' + row.standardId + '\')"><i class="fa fa-send"></i>详情</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

    /*查看详情*/
    function showDetails(id) {
        var url = prefix + "/standDetails/" + id;
        window.location.href = url;
    }
    setTitle("生产标准",true);

</script>
</body>
</html>